﻿using SuperJoe.Framework.Core.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace SuperJoe.Framework.Ioc
{
    public class IocManager
    {
        private static IIocContainer container = null;
        public static IIocContainer Container
        {
            get
            {
                if (container == null)
                {
                    ThrowHelper.ThrowFriendlyException("请先调用Init方法进行初始化.");
                }

                return container;
            }
        }

        public static void Init(IList<string> preLoadAssemblyNames = null)
        {
            var  autoFacContainer = new AutofacIocContainer();
            autoFacContainer.Init(preLoadAssemblyNames);

            container = autoFacContainer;
        }
    }
}
